\(\begin{aligned} {\text{Prevalence}} = \frac{\text{TP + FN}}{\text{TP + FP + TN + FN}} \end{aligned}\)
\(\begin{aligned} \text{Sensitivity (Recall, True Positive Rate)} = \frac{\text{TP}}{\text{TP + FN}} = \frac{\text{TP}}{\text{Real Positives}} = \text{Prob( Predicted Positive | Real Positive )} \end{aligned}\)
\(\begin{aligned} \text{Specificity (True Negative Rate)} = \frac{\text{TN}}{\text{TN + FP}} = \frac{\text{TN}}{\text{Real Negatives}} = \text{Prob( Predicted Negative | Real Negative )} \end{aligned}\)
\(\begin{aligned} \text{PPV (Precision)} = \frac{\text{TP}}{\text{TP + FP}} = \frac{\text{TP}}{\text{Predicted Positives}} = \text{Prob( Real Positive | Predicted Positive )} \end{aligned}\)
\(\begin{aligned} \text{NPV} = \frac{\text{TN}}{\text{TN + FN}} = \frac{\text{TN}}{\text{Predicted Negatives}} = \text{Prob( Real Negative | Predicted Negative )} \end{aligned}\)
\(\begin{aligned} \text{Lift} = \frac{\text{PPV}}{\text{Prevalence}} = \frac{\cfrac{\text{TP}}{\text{TP + FP}}}{\cfrac{\text{TP + FN}}{\text{TP + FP + TN + FN}}} \end{aligned}\)
\(\begin{aligned} \text{Net Benefit} = \frac{\text{TP}}{\text{TP + FP + TN + FN}} - \frac{\text{FP}}{\text{TP + FP + TN + FN}} * {\frac{{p_{t}}}{{1 - p_{t}}}} \end{aligned}\)
## # A tibble: 30 x 4
## population quintile phaty phatx
## <fct> <int> <dbl> <dbl>
## 1 Train 1 0 0.0000921
## 2 Train 2 0 0.000884
## 3 Train 3 0 0.00472
## 4 Train 4 0 0.0115
## 5 Train 5 0.1 0.0510
## 6 Train 6 0.1 0.143
## 7 Train 7 0.222 0.310
## 8 Train 8 0.889 0.701
## 9 Train 9 0.889 0.873
## 10 Train 10 0.889 0.969
## # ... with 20 more rows
## [1] -0.05 1.05
## # A tibble: 30 x 4
## population quintile phaty phatx
## <fct> <int> <dbl> <dbl>
## 1 Train 1 0 0.0000921
## 2 Train 2 0 0.000884
## 3 Train 3 0 0.00472
## 4 Train 4 0 0.0115
## 5 Train 5 0.1 0.0510
## 6 Train 6 0.1 0.143
## 7 Train 7 0.222 0.310
## 8 Train 8 0.889 0.701
## 9 Train 9 0.889 0.873
## 10 Train 10 0.889 0.969
## # ... with 20 more rows
## [1] -0.05 1.05